import { PublishOptions, SubscribeOptions, MessageConsumeModel } from './../src/index';

import EventBus from './../src/index';
console.log('begin test')


// var time = Date.now()
// EventBus.Publish('defualt', 'product', 'product.create', time + '', { id: 'aa', name: 'bb', time: time }).then(p => {
//     console.log('TWO::' + time + '   order_create published:' + p)
// })

var queue = 'product_user_async_product.#'
queue = 'product_search_async_product.#'
EventBus.Subscribe<any>('defualt', queue, message => {
    console.log('消费ONE      用户订阅商品所有消息，同步商品信息到商品用户分表', message)
    return new Promise((resolve, reject) => {
        setTimeout(function () {
            reject('消费失败测试')
        }, 100);
    })
}, { FalilMessageReQueue: false, BasicQOS: 4 })